/*
* $Id: PointViewSettings.cpp 70 2010-03-20 20:21:36Z volok-aleksej@yandex.ru $
*
* Copyright 2008-2009 by Volokitin Alexey
* All rights reserved
*
*/
#include "Common/include.h"
#include "PointViewSettings.h"
#include "../SettingControlIds.h"
#include "Settings/DinIntDefined.h"
#include "Database/Tables/UserFieldsTable.h"
#include "Event/EventId.h"

#define POINT_VIEW_REG_NAME	_T("Software\\Apiary\\PointViewSettings")

CPointViewSettings::CPointViewSettings()
: CSettingsWithUserColumn(POINT_VIEW_ID, POINT_VIEW_REG_NAME, FALSE){
	Init();
}
CPointViewSettings::~CPointViewSettings(){}

std::map<std::tstring, std::tstring> CPointViewSettings::GetStates(){
	std::map<std::tstring, std::tstring> aStates = __super::GetStates();
	aStates.insert(aStates.end(), std::make_pair(STATIC_HEADER1_ID, IApplication::GetApp()->GetLanguageManager()->GetString(SETTINGS_ID)));
	aStates.insert(aStates.end(), std::make_pair(STATIC_VIEW_ID, IApplication::GetApp()->GetLanguageManager()->GetString(VIEW_COLUMN_ID)));
	aStates.insert(aStates.end(), std::make_pair(CHECK_NOTE_ID, CCommonFunction::GetRegValue(POINT_VIEW_REG_NAME, CHECK_NOTE_ID)));
	return aStates;
}

std::map<std::tstring, std::tstring> CPointViewSettings::GetDefaultStates(){
	std::map<std::tstring, std::tstring> aDefault;
	aDefault.insert(aDefault.end(), std::make_pair(CHECK_NOTE_ID, CHECK_BOX_STATE_1));
	return aDefault;
}

std::map<std::tstring, std::vector<Parameter> > CPointViewSettings::GetParameters(){
	std::map<std::tstring, std::vector<Parameter> > aMapParameters = __super::GetParameters();
	std::vector<Parameter> aParameters;

	//static_header1     
	aParameters.push_back(Parameter(TYPE, HEADER));
	aMapParameters.insert(aMapParameters.end(), std::make_pair(STATIC_HEADER1_ID, aParameters));

	//static_view
	aParameters.clear();
	aMapParameters.insert(aMapParameters.end(), std::make_pair(STATIC_VIEW_ID, aParameters));

	//check_boxes
	aMapParameters.insert(aMapParameters.end(), std::make_pair(CHECK_NOTE_ID, aParameters));

	return aMapParameters;
}
int CPointViewSettings::GetTypeTable(){
	return CUserFieldsTable::content::POINTS;
}
std::vector<Window> CPointViewSettings::GetWindows(){
	std::vector<Window> aWindows = __super::GetWindows();
	aWindows.push_back(Window(STATIC, 10, 0, 415, 23, SS_CENTER, IApplication::GetApp()->GetLanguageManager()->GetString(SETTINGS_ID), STATIC_HEADER1_ID));
	aWindows.push_back(Window(STATIC, 10, 30, 415, 15, SS_LEFT, IApplication::GetApp()->GetLanguageManager()->GetString(VIEW_COLUMN_ID), STATIC_VIEW_ID));
	aWindows.push_back(Window(CHECK_BOX, 10, 45, 130, 20, NULL, IApplication::GetApp()->GetLanguageManager()->GetString(COLUMN_NOTE_ID), CHECK_NOTE_ID));
	return aWindows;
}
void CPointViewSettings::PostSave(){
	IApplication::GetApp()->GetEventManager()->SendEvent(POINT_STN_CHANGE_EVENT);
}
CRect CPointViewSettings::GetSizeRegion(){
	return CRect(CPoint(10, 70), CSize(250, 330));
}